import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class T1(QMainWindow):
    def __init__(self, parents=None):
        super(T1, self).__init__(parents)
        layout = QHBoxLayout()
        bar = self.menuBar()
        about = bar.addMenu('About')
        setting = bar.addMenu('Setting')

        author = QAction('Author', self)
        quit = QAction('Quit', self)
        about.addAction(author)
        about.addAction(quit)
        about.triggered[QAction].connect(self.processtrigger)
        # about menu block

        se = QAction('Set', self)
        setting.addAction(se)
        setting.triggered[QAction].connect(self.processtrigger)

        # file.addAction('New')
        # save=QAction('Save',self)
        # save.setShortcut('Ctrl+S')
        # file.addAction(save)
        # edit=file.addMenu('Edit')
        # edit.addAction('copy')
        # edit.addAction('paste')

        # file.addAction(quit)
        # file.triggered[QAction].connect(self.processtrigger)

        tl=QLabel('SBDocker')
        layout.addWidget(tl)

        widget = QWidget()
        widget.setLayout(layout)
        self.setCentralWidget(widget)

        # self.setLayout(layout)
        self.setWindowTitle('MENU')

    def processtrigger(self, q):
        '''get menu status'''
        about_status = q.text()
        # print(about_status)
        if (about_status == "Author"):
            QMessageBox.information(self, 'Author', 'Author:Masaikk')
        elif (about_status == 'Quit'):
            qApp = QApplication.instance()
            # quit
            qApp.quit()
        elif (about_status == "Set"):
            QMessageBox.warning(self, '...', 'no more setting')


if __name__ == '__main__':
    app = QApplication(sys.argv)
    demo = T1()
    demo.show()
    sys.exit(app.exec_())
